<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="referrer" content="never">
    <title>改变文字颜色的动画</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style: none;
        }

        p {
            font-size: 80px;
            font-weight: 600;
            text-align: center;
            line-height: 300px;
            color: transparent;
            background-image: linear-gradient(to right, #f00 10%, #ff0 20%, #0f0 30%, #0ff 40%, #f0f 50%, #00f 60%, #9000ff 70%, #f0090f 80%, #ff9000 90%, #2345dd 100%);
            background-size: 200% 100%;
            /* 兼容写法 */
            background-clip: text;
            -webkit-background-clip: text;

            animation: move 3s ease-in-out infinite alternate;
        }

        @keyframes move {
            from {
                background-position-x: 0;
            }
            to {
                background-position-x: 100%;
            }
        }
    </style>
</head>
<body>
    <p>窗含西岭千秋雪，门泊东吴万里船。</p>

    <!-- 让文字颜色变成背景色：让文字透明，通过背景裁剪（以文字裁剪）即可 -->
    <script type="text/javascript">
        
    </script>
</body>
</html>